package com.capita.chat;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;


public class Connector {

	
    private ServerSocket serverSocket;
    private Socket socket;
    private boolean shutdown = false;
    private short port = 2567;
    private Logger logger = LoggerFactory.getLogger(this.getClass());	
	
	private class Listener implements Runnable{

		private ObjectInputStream ois;
		
		public void run() {
			
			try {
				ois = new ObjectInputStream(socket.getInputStream());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			while (shutdown){
				
			}
			
		}
		
		
	}
	
	private class Dispatcher implements Runnable {

		public void run() {
			
			
		}
		
	}
	
	@PreDestroy
	public void Destroy(){
		shutdown = true;
		
	}
	
	@PostConstruct
	public void Construct(){
		try {
			serverSocket = new ServerSocket(port);
			socket = serverSocket.accept();
		} catch (IOException e) {
			logger.error("Unable to create server socket");
			e.printStackTrace();
		}
	}
	
}
